require.config({
  baseUrl: "./script/",
  paths: {
    // three: 'script/../../../lib/three'
  },
  shim: {
    'script/../../../lib/three': {
      exports: 'THREE'
    }
  }
})

require(['script/../../../lib/three'], function (THREE) {

  init()
  function init() {
    // 渲染器
    const renderer = new THREE.WebGLRenderer();
    renderer.setSize(400, 300);
    document.body.appendChild(renderer.domElement);
    renderer.setClearColor(0x000000);
    const scene = new THREE.Scene()

    // camera
    const camera = new THREE.OrthographicCamera(-10, 10, 7.5, -7.5, 0.1, 100)
    camera.position.set(25, 25, 25);
    camera.lookAt(new THREE.Vector3(0, 0, 0));
    scene.add(camera);

    // light
    const light = new THREE.PointLight(0xffffff, 1, 1000)
    light.position.set(10, 15, 20);
    scene.add(light);

    const materials = []

    const loader = new THREE.TextureLoader()
    // var clothTexture = loader.load( 'textures/patterns/circuit_pattern.png' );

    for (let i = 0; i < 6; ++i) {
      // debugger
      materials.push(new THREE.MeshBasicMaterial({
        map: loader.load('../assets/images/' + i + '.png', function() {
          // 由于图片加载需要时间，所以每加载完一张图片都要重新渲染一次，如果是动画的话则不需要加上这个回调
          renderer.render(scene, camera);
        }),
        overdraw: true
      }));
    }

    const cube = new THREE.Mesh(new THREE.CubeGeometry(5, 5, 5), materials)
    scene.add(cube);

    renderer.render(scene, camera);
  }
})